﻿using DirectUI.Mobile.UI.Controls;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NMock2;
namespace DirectUIUnitTest
{
    
    
    /// <summary>
    ///This is a test class for DirectUIControlTest and is intended
    ///to contain all DirectUIControlTest Unit Tests
    ///</summary>
    [TestClass()]
    public class DirectUIControlTest
    {


        


        /// <summary>
        ///
        ///</summary>
        [TestMethod()]
        public void Invalidate_Should_Return_If_Initializing_Is_True()
        {
            Mockery mocks = new Mockery();
            DirectUIControl target = new DirectUIControl();
            IContainer container = (IContainer)mocks.NewMock(typeof(IContainer));
            //Stub.On(container).Method("Invalidate").WithAnyArguments();
            Expect.Never.On(container).Method("Invalidate").WithAnyArguments();
            target.Container = container;
            target.BeginInit();
            target.Invalidate();
            mocks.VerifyAllExpectationsHaveBeenMet();      
        }
        [TestMethod()]
        public void Invalidate_Should_Call_Its_Containers_Invalidate_Method_If_Initializing_Is_False()
        {
            Mockery mocks = new Mockery();
            DirectUIControl target = new DirectUIControl();
            IContainer container = (IContainer)mocks.NewMock(typeof(IContainer));
            //Stub.On(container).Method("Invalidate").WithAnyArguments();
            Expect.Once.On(container).Method("Invalidate").WithAnyArguments();
            target.Container = container;
            target.EndInit();
            target.Invalidate();
            mocks.VerifyAllExpectationsHaveBeenMet();
        }
    }
}
